package com.lmaye.design.patterns.structural.proxy.staticproxy;

/**
 * -- TeacherProxy
 *
 * @author lmay.Zhou
 * @date 2020/11/17 23:50 星期二
 * @qq 379839355
 * @email lmay@lmaye.com
 * @since JDK1.8
 */
public class TeacherProxy implements ITeacher {
    private ITeacher teacher;

    public TeacherProxy(ITeacher teacher) {
        this.teacher = teacher;
    }

    @Override
    public void teach() {
        before();
        teacher.teach();
        after();
    }

    private void before() {
        System.out.println("代理开始...");
    }

    private void after() {
        System.out.println("代理结束...");
    }
}
